<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>合格率统计</title>
    <link rel="stylesheet" href="css/table.css">
    <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
    <style>
        #content{
            width: 18%;
            height: auto;
            float: left;
        }
        #content1{
            width: 82%;
            height: auto;
            float: left;
        }

        table.dataintable {
            margin-top:0px;
            border-collapse:collapse;
            border:1px solid #aaa;
            width:100%;
        }
        table.dataintable th {
            vertical-align:baseline;
            padding:5px 15px 5px 6px;
            background-color:#3F3F3F;
            border:1px solid #3F3F3F;
            text-align:center;
            color:#fff;
        }
        table.dataintable td {
            vertical-align:text-top;
            padding:6px 15px 6px 6px;
            border:1px solid #aaa;
        }
        table.dataintable tr:nth-child(odd) {
            background-color:#b9cf6a;
        }
        table.dataintable tr:nth-child(even) {
            background-color:#fff;
        }




        #table-1 thead, #table-1 tr {
            border-top-width: 1px;
            border-top-style: solid;
            border-top-color: rgb(230, 189, 189);
        }
        #table-1 {
            border-bottom-width: 1px;
            border-bottom-style: solid;
            border-bottom-color: rgb(230, 189, 189);
        }

        /* Padding and font style */
        #table-1 td, #table-1 th {
            padding: 5px 10px;
            font-size: 12px;
            font-family: Verdana;
            color: rgb(177, 106, 104);
            text-align: center;
        }

        /* Alternating background colors */
        #table-1 tr:nth-child(even) {
            background: rgb(238, 211, 210);
            text-align: center;
        }
        #table-1 tr:nth-child(odd) {
            background: #FFF
        }





    </style>
</head>
<body>
<div id="content"></div>
<div id="content1"></div>



<script>

    $(document).ready(function () {
        query();
    });
    var num=1;
    function details(personLiablePhone) {
        $.ajax({
            url: "inspect/statisticsDetails",
            type: "post",
            data: JSON.stringify({
                personLiablePhone:personLiablePhone,
               /* pageIndex: 1,
                pageSize: 15*/
            }),
            beforeSend: function (request) {
                request.setRequestHeader("token", "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIxIiwiaWF0IjoxNTMyNDA4ODMzLCJzdWIiOiIxLHd6eSwwIiwiZXhwIjoxNTMyNDE2MDMzfQ.DEpHIrk2X8U4Un_SdDNiqqPPEYHXX6DYfx_prQ3QIZQ");
            },
            contentType: "application/json;",
            success: function (data) {
                console.log(data);
                if (data == null || data == "" || data == undefined) {
                    $("#content1").html("暂无数据");
                } else {
                    var content1 = '<table class="table-1" cellspacing="0" border="0"> <thead>\n' +
                        '\n' +
                        '            <th>检测类型</th>\n' +
                        '            <th>检测结果</th>\n' +
                        '            <th>修复后结果</th>\n' +
                        '            <th>施工小队名称</th>\n' +
                        '            <th>分部分项工程名称</th>\n' +
                        '            <th>附件</th>\n' +
                        '        </thead>\n' +
                        '<tbody>';
                    var list = data.data;
                    for (var i = 0; i < list.length;i++) {
                        var obj = list[i];
                        var inspectState = obj.inspectState;
                        if(inspectState == 1){
                            inspectState = "安全检测";
                        }else{
                            inspectState = "质量检测";
                        }
                        content1 += '<tr>' +
                            '<td>' + inspectState + '</td>' +
                            '<td>' + obj.inspectStartResult + '</td>' +
                            '<td>' + obj.inspectEndResult + '</td>' +
                            '<td>' + obj.teamName + '</td>' +
                            '<td>' + obj.teamDesc + '</td>' +
                            '<td>' + obj.fileUrl + '</td>' +
                            '<tr/>' +
                            '</tbody>';
                    }
                    content1 +='</table>';
                    num++;
                    console.log(content1);
                    $("#content1").html(content1);
                }

            }
        });

    }

    function query() {
        $.ajax({
            url: "inspect/statistics",
            type: "post",
            data: JSON.stringify({
            }),
            beforeSend: function (request) {
                request.setRequestHeader("token", "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIxIiwiaWF0IjoxNTMyNDA4ODMzLCJzdWIiOiIxLHd6eSwwIiwiZXhwIjoxNTMyNDE2MDMzfQ.DEpHIrk2X8U4Un_SdDNiqqPPEYHXX6DYfx_prQ3QIZQ");
            },
            contentType: "application/json;",
            success: function (data) {
                console.log(data);
                if (data == null || data == "" || data == undefined) {
                    $("#content").html("暂无数据");
                } else {
                    var content = '<table class="dataintable" cellspacing="0" border="0"> <thead>\n' +
                        '\n' +
                        '        <tr>\n' +
                        '            <th>人员信息</th>\n' +
                        '        </tr>  ';
                    var list = data.data;
                    for (var i = 0; i < list.length;i++) {
                        var obj = list[i];

                        content += '<tr>' +
                            '<td><a href="javascript:;" onclick="details(' + obj.personLiablePhone + ')">'+obj.personLiableName+'('+obj.personLiablePhone+')</a></td>' +
                            '<tr/>';
                    }
                    content +='</table>';
                    console.log(content);
                    $("#content").html(content);
                }

            }
        });
    }
</script>
</body>

</html>